<template>
  <div class="financeProductBox">
    <div
      class="item"
      v-for="item in finaceList"
      :key="item.companyFinancingId"
      @click="
        $router.push({
          path: '/finance/financeProductDetail',
          query: { productId: item.companyFinancingId },
        })
      "
    >
      <div class="box_now">
        <div class="title">{{ item.productTitle }}</div>
        <div class="titleSun">{{ getObj(item.object) }}</div>
      </div>
      <div class="box_time">
        <div class="time1">申报时间：{{ item.applyStartTime }}</div>
        <div class="time2">
          发布时间：{{ item.publishTime }}
          <span>发文部门：{{ getPub(item.publishDepartment) }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getDetailedPage } from "@/common/api/index.js";
export default {
  props: ["objList", "pubList"],
  data() {
    return {
      finaceList: [],
    };
  },
  methods: {
    getObj(data) {
      if (this.objList && this.objList.length) {
        let obj = this.objList.find((item) => item.dictValue == data);
        return obj && obj.dictLabel;
      }
    },
    getPub(data) {
      if (this.pubList.length) {
        let obj = this.pubList.find((item) => item.dictValue == data);
        return obj && obj.dictLabel;
      }
    },
    // 金融产品清单列表
    async getDetailedPage() {
      let param = {
        pageNum: 1,
        pageSize: 6,
      };
      let res = await getDetailedPage(param);
      console.log("finaceList", res);
      this.finaceList = res.rows;
    },
  },
  mounted() {
    this.getDetailedPage();
  },
};
</script>

<style lang="scss" scoped>
.financeProductBox {
  display: flex;
  flex-wrap: wrap;
  margin-top: 30px;
  background: none;
  .item {
    height: 142px;
    width: 380px;
    border: 1px solid #eeeeee;
    margin-bottom: 20px;
    background: #ffffff;
    box-shadow: 4px 6px 5px 0px rgba(0, 19, 39, 0.04);
    cursor: pointer;
    .box_now {
      border-bottom: 1px solid #eee;
      padding: 15px;
      text-align: left;
      .title {
        font-size: 18px;
        font-weight: 700;
        color: #333333;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .titleSun {
        font-size: 14px;
        color: #045db9;
      }
    }
    .box_time {
      padding: 10px 15px;
      text-align: left;
      font-size: 14px;
      color: #999999;
    }
  }
  .item:nth-child(3n + 2) {
    margin: 0 25px;
  }
}
</style>